From 10c20c0c5b130c389680e37e4e4aba8e2abdbf1e Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 24 Dec 2022 05:22:50 -0800 Subject: password prompt and pin fixes --- src/routes/(app)/[username]/generate/+page.svelte | 6 +++--- src/routes/(app)/[username]/settings/[...tab]/+page.svelte | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/routes/(app)/[username]') diff --git a/src/routes/(app)/[username]/generate/+page.svelte b/src/routes/(app)/[username]/generate/+page.svelte index 559d0d14..330ccedb 100644 --- a/src/routes/(app)/[username]/generate/+page.svelte +++ b/src/routes/(app)/[username]/generate/+page.svelte @@ -7,7 +7,7 @@ import * as ecc from 'tiny-secp256k1'; import { bip32, stretch, post } from '$lib/utils'; import { goto, invalidate } from '$app/navigation'; - import { loginRedirect } from '$lib/store'; + import { loginRedirect, password } from '$lib/store'; import { Pin } from '$comp'; import { pin } from '$lib/store'; @@ -16,7 +16,7 @@ const { encode, toWords } = bech32m; - let loaded, mnemonic, key, password, seed, entropy, cipher, pubkey, salt, child; + let loaded, mnemonic, key, seed, entropy, cipher, pubkey, salt, child; onMount(async () => { setTimeout(() => (loaded = true), 50); @@ -35,7 +35,7 @@ let bytes = new Uint8Array( await crypto.subtle.encrypt( { name: 'AES-GCM', iv: new Uint8Array(16) }, - await stretch(password, salt), + await stretch($password, salt), Uint8Array.from(Buffer.from(entropy, 'hex')) ) ); diff --git a/src/routes/(app)/[username]/settings/[...tab]/+page.svelte b/src/routes/(app)/[username]/settings/[...tab]/+page.svelte index d47ce0de..3b213a11 100644 --- a/src/routes/(app)/[username]/settings/[...tab]/+page.svelte +++ b/src/routes/(app)/[username]/settings/[...tab]/+page.svelte @@ -28,10 +28,10 @@ $: form?.success && success('Settings saved!'); - // $: if (form?.message?.startsWith('Pin')) { - // failure('Wrong pin, try again'); - // $pin = ''; - // } + $: if (form?.message?.startsWith('Pin')) { + failure('Wrong pin, try again'); + $pin = ''; + } let tabs = [ { name: 'account', key: 'ACCOUNT', comp: Account }, -- cgit v1.2.3